/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package adressbook;

import View.MainInterface;
import View.ViewContact;
import View.Window;
import Model.Contact;
import static adressbook.Initialisation.init;
import java.io.IOException;
import java.util.ArrayList;

/**
 *
 * @author Martin LEGRIS
 */
public class AdressBook {

    /**
     * @param args the command line arguments
     */
    static ArrayList<Contact> myContacts = new ArrayList<>();
    public static final String FIRSTNAME = "First Name";
    public static final String LASTNAME = "Last Name";
    public static final String HOME_ADDRRESS = "Home Address";
    public static final String COMPANY_ADDRESS = "Company Address";
    public static final String HOME_PHONE = "Home Phone";
    public static final String PROF_MOBILE_PHONE = "Professionnal Mobile Phone";
    public static final String PERSO_MOBILE_PHONE = "Personnal Mobile Phone";
    public static final String PROF_OFFICE_PHONE = "Office Phone";
    public static final String HOME_PAGE = "Home page";
    public static final String PROF_EMAIL = "Professionnal E-mail";
    public static final String PERSO_EMAIL = "Personnal E-mail";
    public static final String SKYPE = "Skype pseudo";
    public static final String NOTES = "Notes";

    public static void main(String[] args) {
        // TODO code application logic here
        init(myContacts);
        MainInterface monBook;

        MainInterface.run(myContacts);

    }

    public static void addContact(String[] data) {
        Contact newContact = new Contact(data);
        myContacts.add(newContact);

    }

    public static void displayContact(int index) throws IOException {
        Contact theContact = myContacts.get(index);
        ViewContact display = new ViewContact(theContact, index);
    }

    public static ArrayList getMyContacts() {
        return myContacts;
    }

    public static void editContact(String[] data, int index) {
        myContacts.get(index).setFname(data[0]);
        myContacts.get(index).setLname(data[1]);
        myContacts.get(index).setHome_address(data[2]);
        myContacts.get(index).setCompany_address(data[3]);
        myContacts.get(index).setMobile_phone(data[4]);
        myContacts.get(index).setHome_phone(data[5]);
        myContacts.get(index).setProf_mobile_phone(data[6]);
        myContacts.get(index).setProf_office_phone(data[7]);
        myContacts.get(index).setHome_page(data[8]);
        myContacts.get(index).setProf_email(data[9]);
        myContacts.get(index).setPerso_email(data[10]);
        myContacts.get(index).setSkype(data[11]);
        myContacts.get(index).setNotes(data[12]);
        myContacts.get(index).setNotes(data[13]);

    }

    public static void deleteContact(int i) {
        myContacts.remove(i);
    }
}
